package com.ls.thread.ch03.demo01;

public class TicketRunnable extends Thread{
	
	
	private int ticket=10;
	
	@SuppressWarnings("static-access")
	@Override
	public void run() {
		
		synchronized (this) {
			
			}
			while(ticket>0){
				try {
					Thread.currentThread().sleep(100);
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
				System.out.println(this.getName()+"卖出第"+ticket+"张票，现在还有"+(ticket-1));
				ticket=ticket-1;
			}
	}
	

}
